1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
// // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIMemoryInfoDumper.idl // /// `interface nsIFinishDumpingCallback : nsISupports` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIFinishDumpingCallback { vtable: *const nsIFinishDumpingCallbackVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIFinishDumpingCallback. unsafe impl XpCom for nsIFinishDumpingCallback { const IID: nsIID = nsID(0x2dea18fc, 0xfbfa, 0x4bf7, [0xad, 0x45, 0x0e, 0xfa, 0xf5, 0x49, 0x5f, 0x5e]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIFinishDumpingCallback { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIFinishDumpingCallback. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIFinishDumpingCallbackCoerce { /// Cheaply cast a value of this type from a `nsIFinishDumpingCallback`. fn coerce_from(v: &nsIFinishDumpingCallback) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIFinishDumpingCallbackCoerce for nsIFinishDumpingCallback { #[inline] fn coerce_from(v: &nsIFinishDumpingCallback) -> &Self { v } } impl nsIFinishDumpingCallback { /// Cast this `nsIFinishDumpingCallback` to one of its base interfaces. #[inline] pub fn coerce<T: nsIFinishDumpingCallbackCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIFinishDumpingCallback { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIFinishDumpingCallbackCoerce for T { #[inline] fn coerce_from(v: &nsIFinishDumpingCallback) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIFinishDumpingCallback // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIFinishDumpingCallbackVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void callback (in nsISupports data); */ pub Callback: unsafe extern "system" fn (this: *const nsIFinishDumpingCallback, data: *const nsISupports) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIFinishDumpingCallback { /// `void callback (in nsISupports data);` #[inline] pub unsafe fn Callback(&self, data: *const nsISupports) -> nsresult { ((*self.vtable).Callback)(self, data) } } /// `interface nsIDumpGCAndCCLogsCallback : nsISupports` /// /// ```text /// /** /// * Callback interface for |dumpGCAndCCLogsToFile|, below. Note that /// * these method calls can occur before |dumpGCAndCCLogsToFile| /// * returns. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIDumpGCAndCCLogsCallback { vtable: *const nsIDumpGCAndCCLogsCallbackVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIDumpGCAndCCLogsCallback. unsafe impl XpCom for nsIDumpGCAndCCLogsCallback { const IID: nsIID = nsID(0xdc1b2b24, 0x65bd, 0x441b, [0xb6, 0xbd, 0xcb, 0x58, 0x25, 0xa7, 0xed, 0x14]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIDumpGCAndCCLogsCallback { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIDumpGCAndCCLogsCallback. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIDumpGCAndCCLogsCallbackCoerce { /// Cheaply cast a value of this type from a `nsIDumpGCAndCCLogsCallback`. fn coerce_from(v: &nsIDumpGCAndCCLogsCallback) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIDumpGCAndCCLogsCallbackCoerce for nsIDumpGCAndCCLogsCallback { #[inline] fn coerce_from(v: &nsIDumpGCAndCCLogsCallback) -> &Self { v } } impl nsIDumpGCAndCCLogsCallback { /// Cast this `nsIDumpGCAndCCLogsCallback` to one of its base interfaces. #[inline] pub fn coerce<T: nsIDumpGCAndCCLogsCallbackCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIDumpGCAndCCLogsCallback { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIDumpGCAndCCLogsCallbackCoerce for T { #[inline] fn coerce_from(v: &nsIDumpGCAndCCLogsCallback) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIDumpGCAndCCLogsCallback // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIDumpGCAndCCLogsCallbackVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void onDump (in nsIFile aGCLog, in nsIFile aCCLog, in bool aIsParent); */ pub OnDump: unsafe extern "system" fn (this: *const nsIDumpGCAndCCLogsCallback, aGCLog: *const nsIFile, aCCLog: *const nsIFile, aIsParent: bool) -> nsresult, /* void onFinish (); */ pub OnFinish: unsafe extern "system" fn (this: *const nsIDumpGCAndCCLogsCallback) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIDumpGCAndCCLogsCallback { /// ```text /// /** /// * Called whenever a process has successfully finished dumping its GC/CC logs. /// * Incomplete dumps (e.g., if the child crashes or is killed due to memory /// * exhaustion) are not reported. /// * /// * @param aGCLog The file that the GC log was written to. /// * /// * @param aCCLog The file that the CC log was written to. /// * /// * @param aIsParent indicates whether this log file pair is from the /// * parent process. /// */ /// ``` /// /// `void onDump (in nsIFile aGCLog, in nsIFile aCCLog, in bool aIsParent);` #[inline] pub unsafe fn OnDump(&self, aGCLog: *const nsIFile, aCCLog: *const nsIFile, aIsParent: bool) -> nsresult { ((*self.vtable).OnDump)(self, aGCLog, aCCLog, aIsParent) } /// ```text /// /** /// * Called when GC/CC logging has finished, after all calls to |onDump|. /// */ /// ``` /// /// `void onFinish ();` #[inline] pub unsafe fn OnFinish(&self, ) -> nsresult { ((*self.vtable).OnFinish)(self, ) } } /// `interface nsIMemoryInfoDumper : nsISupports` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIMemoryInfoDumper { vtable: *const nsIMemoryInfoDumperVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIMemoryInfoDumper. unsafe impl XpCom for nsIMemoryInfoDumper { const IID: nsIID = nsID(0x48541b74, 0x47ee, 0x4a62, [0x95, 0x57, 0x7f, 0x4b, 0x80, 0x9b, 0xda, 0x5c]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIMemoryInfoDumper { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIMemoryInfoDumper. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIMemoryInfoDumperCoerce { /// Cheaply cast a value of this type from a `nsIMemoryInfoDumper`. fn coerce_from(v: &nsIMemoryInfoDumper) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIMemoryInfoDumperCoerce for nsIMemoryInfoDumper { #[inline] fn coerce_from(v: &nsIMemoryInfoDumper) -> &Self { v } } impl nsIMemoryInfoDumper { /// Cast this `nsIMemoryInfoDumper` to one of its base interfaces. #[inline] pub fn coerce<T: nsIMemoryInfoDumperCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIMemoryInfoDumper { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIMemoryInfoDumperCoerce for T { #[inline] fn coerce_from(v: &nsIMemoryInfoDumper) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIMemoryInfoDumper // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIMemoryInfoDumperVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void dumpMemoryReportsToNamedFile (in AString aFilename, in nsIFinishDumpingCallback aFinishDumping, in nsISupports aFinishDumpingData, in boolean aAnonymize); */ pub DumpMemoryReportsToNamedFile: unsafe extern "system" fn (this: *const nsIMemoryInfoDumper, aFilename: &::nsstring::nsAString, aFinishDumping: *const nsIFinishDumpingCallback, aFinishDumpingData: *const nsISupports, aAnonymize: bool) -> nsresult, /* void dumpMemoryInfoToTempDir (in AString aIdentifier, in boolean aAnonymize, in boolean aMinimizeMemoryUsage); */ pub DumpMemoryInfoToTempDir: unsafe extern "system" fn (this: *const nsIMemoryInfoDumper, aIdentifier: &::nsstring::nsAString, aAnonymize: bool, aMinimizeMemoryUsage: bool) -> nsresult, /* void dumpGCAndCCLogsToFile (in AString aIdentifier, in bool aDumpAllTraces, in bool aDumpChildProcesses, in nsIDumpGCAndCCLogsCallback aCallback); */ pub DumpGCAndCCLogsToFile: unsafe extern "system" fn (this: *const nsIMemoryInfoDumper, aIdentifier: &::nsstring::nsAString, aDumpAllTraces: bool, aDumpChildProcesses: bool, aCallback: *const nsIDumpGCAndCCLogsCallback) -> nsresult, /* void dumpGCAndCCLogsToSink (in bool aDumpAllTraces, in nsICycleCollectorLogSink aSink); */ pub DumpGCAndCCLogsToSink: unsafe extern "system" fn (this: *const nsIMemoryInfoDumper, aDumpAllTraces: bool, aSink: *const nsICycleCollectorLogSink) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIMemoryInfoDumper { /// ```text /// /** /// * This dumps gzipped memory reports for this process and its child /// * processes. If a file of the given name exists, it will be overwritten. /// * /// * @param aFilename The output file. /// * /// * @param aFinishDumping The callback called on completion. /// * /// * @param aFinishDumpingData The environment for the callback. /// * /// * @param aAnonymize Should the reports be anonymized? /// * /// * Sample output, annotated with comments for explanatory purposes. /// * /// * { /// * // The version number of the format, which will be incremented each time /// * // backwards-incompatible changes are made. A mandatory integer. /// * "version": 1 /// * /// * // Equal to nsIMemoryReporterManager::hasMozMallocUsableSize. A /// * // mandatory boolean. /// * "hasMozMallocUsableSize": true, /// * /// * // The memory reports. A mandatory array. /// * "reports": [ /// * // The properties correspond to the arguments of /// * // nsIHandleReportCallback::callback. Every one is mandatory. /// * {"process":"Main Process (pid 12345)", "path":"explicit/foo/bar", /// * "kind":1, "units":0, "amount":2000000, "description":"Foo bar."}, /// * {"process":"Main Process (pid 12345)", "path":"heap-allocated", /// * "kind":1, "units":0, "amount":3000000, "description":"Heap allocated."}, /// * {"process":"Main Process (pid 12345)", "path":"vsize", /// * "kind":1, "units":0, "amount":10000000, "description":"Vsize."} /// * ] /// * } /// */ /// ``` /// /// `void dumpMemoryReportsToNamedFile (in AString aFilename, in nsIFinishDumpingCallback aFinishDumping, in nsISupports aFinishDumpingData, in boolean aAnonymize);` #[inline] pub unsafe fn DumpMemoryReportsToNamedFile(&self, aFilename: &::nsstring::nsAString, aFinishDumping: *const nsIFinishDumpingCallback, aFinishDumpingData: *const nsISupports, aAnonymize: bool) -> nsresult { ((*self.vtable).DumpMemoryReportsToNamedFile)(self, aFilename, aFinishDumping, aFinishDumpingData, aAnonymize) } /// ```text /// /** /// * Similar to dumpMemoryReportsToNamedFile, this method dumps gzipped memory /// * reports for this process and its child processes to files in the tmp /// * directory called memory-reports-<identifier>-<pid>.json.gz (or something /// * similar, such as memory-reports-<identifier>-<pid>-1.json.gz; no existing /// * file will be overwritten). /// * /// * If DMD is enabled, this method also dumps gzipped DMD output for this /// * process and its child processes to files in the tmp directory called /// * dmd-<identifier>-<pid>.txt.gz (or something similar; again, no existing /// * file will be overwritten). /// * /// * @param aIdentifier this identifier will appear in the filename of our /// * about:memory dump and those of our children. /// * /// * If the identifier is empty, the implementation may set it arbitrarily /// * and use that new value for its own dump and the dumps of its child /// * processes. For example, the implementation may set |aIdentifier| to the /// * number of seconds since the epoch. /// * /// * @param aAnonymize Should the reports be anonymized? /// * /// * @param aMinimizeMemoryUsage indicates whether we should run a series of /// * gc/cc's in an attempt to reduce our memory usage before collecting our /// * memory report. /// */ /// ``` /// /// `void dumpMemoryInfoToTempDir (in AString aIdentifier, in boolean aAnonymize, in boolean aMinimizeMemoryUsage);` #[inline] pub unsafe fn DumpMemoryInfoToTempDir(&self, aIdentifier: &::nsstring::nsAString, aAnonymize: bool, aMinimizeMemoryUsage: bool) -> nsresult { ((*self.vtable).DumpMemoryInfoToTempDir)(self, aIdentifier, aAnonymize, aMinimizeMemoryUsage) } /// ```text /// /** /// * Dump GC and CC logs to files in the OS's temp directory (or in /// * $MOZ_CC_LOG_DIRECTORY, if that environment variable is specified). /// * /// * @param aIdentifier If aIdentifier is non-empty, this string will appear in /// * the filenames of the logs we create (both for this process and, if /// * aDumpChildProcesses is true, for our child processes). /// * /// * If aIdentifier is empty, the implementation may set it to an /// * arbitrary value; for example, it may set aIdentifier to the number /// * of seconds since the epoch. /// * /// * @param aDumpAllTraces indicates whether we should run an all-traces CC /// * log. An all-traces log visits all objects currently eligible for cycle /// * collection, while a non-all-traces log avoids visiting some objects /// * which we know are reachable. /// * /// * All-traces logs are much bigger than the alternative, but they may be /// * helpful when trying to understand why a particular object is alive. For /// * example, a non-traces-log will skip references held by an active /// * document; if your object is being held alive by such a document, you /// * probably want to see those references. /// * /// * @param aDumpChildProcesses indicates whether we should call /// * DumpGCAndCCLogsToFile in our child processes. If so, the child processes /// * will dump their children, and so on. /// * /// */ /// ``` /// /// `void dumpGCAndCCLogsToFile (in AString aIdentifier, in bool aDumpAllTraces, in bool aDumpChildProcesses, in nsIDumpGCAndCCLogsCallback aCallback);` #[inline] pub unsafe fn DumpGCAndCCLogsToFile(&self, aIdentifier: &::nsstring::nsAString, aDumpAllTraces: bool, aDumpChildProcesses: bool, aCallback: *const nsIDumpGCAndCCLogsCallback) -> nsresult { ((*self.vtable).DumpGCAndCCLogsToFile)(self, aIdentifier, aDumpAllTraces, aDumpChildProcesses, aCallback) } /// ```text /// /** /// * Like |dumpGCAndCCLogsToFile|, but sends the logs to the given log /// * sink object instead of accessing the filesystem directly, and /// * dumps the current process only. /// */ /// ``` /// /// `void dumpGCAndCCLogsToSink (in bool aDumpAllTraces, in nsICycleCollectorLogSink aSink);` #[inline] pub unsafe fn DumpGCAndCCLogsToSink(&self, aDumpAllTraces: bool, aSink: *const nsICycleCollectorLogSink) -> nsresult { ((*self.vtable).DumpGCAndCCLogsToSink)(self, aDumpAllTraces, aSink) } }